package cn.doitedu.rtmk.interfaces;

import cn.doitedu.rtmk.beans.UserEvent;
import com.alibaba.fastjson.JSONObject;
import org.apache.flink.api.common.functions.RuntimeContext;
import org.apache.flink.util.Collector;
import org.roaringbitmap.RoaringBitmap;

public interface IRuleCalculatorV3 {

    /**
     * 规则运算机的初始化方法
     * @param preSelectUsersBitmap 预圈选的人群集合的bitmap
     * @param ruleInstanceParams 规则实例的参数
     */
    public void open(RoaringBitmap preSelectUsersBitmap, JSONObject ruleInstanceParams, RuntimeContext runtimeContext);

    /**
     * 规则运算机的核心逻辑方法
     * @param userEvent 用户行为
     * @param out 数据输出器
     */
    public void calc(UserEvent userEvent, Collector<JSONObject> out) throws Exception;


}
